//package org.ricks.robot.business;
//
//import org.ricks.net.transport.kcp.KcpSession;
//import org.ricks.protocol.ByteBuf;
//import org.ricks.robot.Monitor;
//import org.ricks.robot.RobotInfo;
//import org.ricks.robot.RobotManager;
//import org.ricks.robot.RobotRun;
//import proto.common.*;
//
//import java.util.List;
//import java.util.concurrent.TimeUnit;
//
//public class RobotRoleAction {
//
//    public static List<Integer> roleIds = List.of(101001,101002,101003,101004,101005, 102001,102002,102003,102004,102005, 103001,103002,103003,103004,103005);
//
//
//    public static void starRoleAction(KcpSession session) {
//
//        RobotInfo robotInfo = RobotManager.get(session);
//        robotInfo.action = FProto.Action.CharacterCreatePush;
//        robotInfo.initCardAction = true;
//        RobotAction.addItem(session, 101001, 10000);
//
////        ThreadUtils.sleep(1000L);
////
////        RobotAction.addItem(session, 102001, 1);
////
////        ThreadUtils.sleep(1000L);
////
////        RobotAction.addItem(session, 103001, 1);
//
////        RobotAction.addItem(session, 1000, 100000000);
////        RobotAction.addItem(session, 1001, 100000000);
////        RobotAction.addItem(session, 1002, 100000000);
////        RobotAction.addItem(session, 1003, 100000000);
////        RobotAction.addItem(session, 1010, 100000000);
////        RobotAction.addItem(session, 1011, 100000000);
////        RobotAction.addItem(session, 1012, 100000000);
////        RobotAction.addItem(session, 1013, 100000000);
////        RobotAction.addItem(session, 1020, 100000000);
////        RobotAction.addItem(session, 1021, 100000000);
////        RobotAction.addItem(session, 1022, 100000000);
////        RobotAction.addItem(session, 1023, 100000000);
////        RobotAction.addItem(session, 1030, 100000000);
////        RobotAction.addItem(session, 1031, 100000000);
////        RobotAction.addItem(session, 1032, 100000000);
////        RobotAction.addItem(session, 1033, 100000000);
////        RobotAction.addItem(session, 101, 960000000);
//
////        initRoleStarLvItems(session);
////        for (int i = 0; i < 100 ; i++) {
////            roleStarLvAction(session, 101001);
////
////        }
//
//    }
//
//    public static void roleLvUpAction(KcpSession session, int cardId) {
//        RobotInfo robotInfo = RobotManager.get(session);
//        RobotRun.scheduledExecutorService.schedule(() -> {
//            Monitor.addActionRequest(session, FProto.Action.CharacterUpgrade);
//            robotInfo.requestTimeMap.put(FProto.Action.CharacterUpgrade, System.currentTimeMillis());
//            PBCharacter pbCharacter = PBCharacter.newBuilder()
//                    .setCharId(cardId)
//                    .build();
//            PBItem pbItem1 = PBItem.newBuilder()
//                    .setItemId(190)
//                    .setNum(1)
//                    .build();
//            PBItem pbItem2 = PBItem.newBuilder()
//                    .setItemId(191)
//                    .setNum(1)
//                    .build();
//            PBItem pbItem3 = PBItem.newBuilder()
//                    .setItemId(192)
//                    .setNum(1)
//                    .build();
//            PBItemPack pbItemPack = PBItemPack.newBuilder()
//                    .addItemArray(pbItem1)
//                    .addItemArray(pbItem2)
//                    .addItemArray(pbItem3)
//                    .build();
//
//            PBPlayer pbPlayer = PBPlayer.newBuilder()
//                    .addCharacters(pbCharacter)
//                    .setItemPack(pbItemPack)
//                    .build();
//            FProto fProto = FProto.newBuilder()
//                    .setKey(FProto.Key.Player)
//                    .setAction(FProto.Action.CharacterUpgrade)
//                    .setSelf(pbPlayer)
//                    .build();
//            byte[] data = fProto.toByteArray();
//            int lv = robotInfo.cardLvMap.getOrDefault(cardId, 1) + 1;
//            robotInfo.cardLvMap.put(cardId, lv );
//            ByteBuf buf = new ByteBuf(1024);
//            buf.writeByte((byte) 0x03);
//            buf.writeBytes(data);
//
//            session.send(buf.toArray());
//        }, 1000, TimeUnit.MILLISECONDS);
//    }
//
//    /**
//     * 角色突破
//     */
//    public static void roleStarLvAction(KcpSession session, int cardId) {
//        RobotInfo robotInfo = RobotManager.get(session);
//        RobotRun.scheduledExecutorService.schedule(() -> {
//            Monitor.addActionRequest(session, FProto.Action.CharacterStarUp);
//            robotInfo.requestTimeMap.put(FProto.Action.CharacterStarUp, System.currentTimeMillis());
//            PBCharacter pbCharacter = PBCharacter.newBuilder()
//                    .setCharId(cardId)
//                    .build();
//
//            PBPlayer pbPlayer = PBPlayer.newBuilder()
//                    .addCharacters(pbCharacter)
//                    .build();
//            FProto fProto = FProto.newBuilder()
//                    .setKey(FProto.Key.Player)
//                    .setAction(FProto.Action.CharacterStarUp)
//                    .setSelf(pbPlayer)
//                    .build();
//
//            byte[] data = fProto.toByteArray();
//
//            ByteBuf buf = new ByteBuf(1024);
//            buf.writeByte((byte) 0x03);
//            buf.writeBytes(data);
//            int start = robotInfo.cardStarMap.getOrDefault(cardId, 1) + 1;
//            robotInfo.cardStarMap.put(cardId, start );
//            session.send(buf.toArray());
//        }, 1000, TimeUnit.MILLISECONDS);
//
//    }
//
//    public static void roleLogout(KcpSession session) {
//        RobotRun.scheduledExecutorService.schedule(() -> {
//            FProto fProto = FProto.newBuilder()
//                    .setKey(FProto.Key.Base)
//                    .setAction(FProto.Action.Logout)
//                    .build();
//
//            byte[] data = fProto.toByteArray();
//            System.err.println("logout.....");
//            ByteBuf buf = new ByteBuf(1024);
//            buf.writeByte((byte) 0x03);
//            buf.writeBytes(data);
//            session.send(buf.toArray());
//        }, 50000,TimeUnit.MILLISECONDS);
//    }
//
//    public static void initRoleStarLvItems(KcpSession session) {
//        RobotInfo robotInfo = RobotManager.get(session);
//        robotInfo.action = FProto.Action.CharacterStarUp;
//        RobotAction.addItem(session, 31101,50000);
////        RobotAction.addItem(session, 31102,5);
////        RobotAction.addItem(session, 31103,5);
////        RobotAction.addItem(session, 31104,5);
////        RobotAction.addItem(session, 31105,5);
////        RobotAction.addItem(session, 31201,5);
////        RobotAction.addItem(session, 31202,5);
////        RobotAction.addItem(session, 31203,5);
////        RobotAction.addItem(session, 31204,5);
////        RobotAction.addItem(session, 31205,5);
////
////        RobotAction.addItem(session, 31301,5);
////        RobotAction.addItem(session, 31302,5);
////        RobotAction.addItem(session, 31303,5);
////        RobotAction.addItem(session, 31304,5);
////        RobotAction.addItem(session, 31305,5);
////        RobotAction.addItem(session, 31401,5);
////        RobotAction.addItem(session, 31402,5);
////        RobotAction.addItem(session, 31403,5);
////        RobotAction.addItem(session, 31404,5);
////        RobotAction.addItem(session, 31405,5);
////
////        RobotAction.addItem(session, 32101,10);
////        RobotAction.addItem(session, 32102,10);
////        RobotAction.addItem(session, 32103,10);
////        RobotAction.addItem(session, 32104,10);
////        RobotAction.addItem(session, 32105,10);
////
////        RobotAction.addItem(session, 33101,5);
////        RobotAction.addItem(session, 33102,5);
////        RobotAction.addItem(session, 33103,5);
////        RobotAction.addItem(session, 33104,5);
////        RobotAction.addItem(session, 33105,5);
////        RobotAction.addItem(session, 33201,5);
////        RobotAction.addItem(session, 33202,5);
////        RobotAction.addItem(session, 33203,5);
////        RobotAction.addItem(session, 33204,5);
////        RobotAction.addItem(session, 33205,5);
////
////        RobotAction.addItem(session, 34101,5);
////        RobotAction.addItem(session, 34102,5);
////        RobotAction.addItem(session, 34103,5);
////        RobotAction.addItem(session, 34104,5);
////        RobotAction.addItem(session, 34105,5);
////        RobotAction.addItem(session, 34201,5);
////        RobotAction.addItem(session, 34202,5);
////        RobotAction.addItem(session, 34203,5);
////        RobotAction.addItem(session, 34204,5);
////        RobotAction.addItem(session, 34205,5);
////        RobotAction.addItem(session, 34301,5);
////        RobotAction.addItem(session, 34302,5);
////        RobotAction.addItem(session, 34303,5);
////        RobotAction.addItem(session, 34304,5);
////        RobotAction.addItem(session, 34305,5);
//    }
//}
